package org.zj.webview.app.listener;

import org.noear.solon.core.event.EventListener;
import org.zj.webview.type.WebViewState;

/**
 * @author zj
 * @since 2025/7/25
 */
public interface WebViewStateListener extends EventListener<WebViewState> {

    @Override
    default void onEvent(WebViewState state) {
        switch (state) {
            case STARTING:
                onStarting();
                break;
            case STARTED:
                onStarted();
                break;
            case STOPPED:
                onStopped();
                break;
            case ERROR:
                onError();
                break;
        }
    }

    default void onStarting() {
    }

    default void onStarted() {
    }

    default void onStopped() {
    }

    default void onError() {
    }

}
